//
//  XTPCircleScrollMenu.h
//  YRADScrollViewDemo
//
//  Created by Leon He on 2017/5/16.
//  Copyright © 2017年 YueRuo. All rights reserved.
//

#import <UIKit/UIKit.h>
@protocol YRADScrollViewDataSource;
@protocol YRADScrollViewDelegate;

@interface XTPCircleScrollMenu : UIView

@property (assign, nonatomic) NSInteger currentPage;
@property (assign, nonatomic) BOOL scrollEnabled; //default is YES
@property (assign, nonatomic) BOOL cycleEnabled;  //是否可循环滚动，default is YES
@property (weak, nonatomic) id<YRADScrollViewDataSource> dataSource;
@property (weak, nonatomic) id<YRADScrollViewDelegate> delegate;
@property (assign, nonatomic) BOOL viewTappedAlwaysScrollMiddle; //点击某个item后是否这个item总是移动到中间位置，适用于三个item的情况

- (id)dequeueReusableView; //重用池中取出一个控件
- (void)reloadData;
@end

@protocol YRADScrollViewDataSource <NSObject>
/*!
 *	@brief	获取数据源，要注意的是，使用dequeueReusableView进行获取，如果返回为nil，则再进行创建，类似tableView早前的数据获取方式。
 *
 *	@param 	pageIndex 	第几页
 *
 *	@return	要展示的控件
 */
- (UIView *)viewForYRADScrollView:(XTPCircleScrollMenu *)adScrollView atPage:(NSInteger)pageIndex;
- (NSUInteger)numberOfViewsForYRADScrollView:(XTPCircleScrollMenu *)adScrollView;
@end

@protocol YRADScrollViewDelegate <NSObject>
@optional
- (void)adScrollView:(XTPCircleScrollMenu *)adScrollView didClickedAtPage:(NSInteger)pageIndex;//点击了某一页
- (void)adScrollView:(XTPCircleScrollMenu *)adScrollView didScrollToPage:(NSInteger)pageIndex;//滚动到某一页
- (void)adScrollView:(XTPCircleScrollMenu *)adScrollView willDisplayView:(UIView *)view forPage:(NSInteger)pageIndex;//某页要出现了
- (void)adScrollView:(XTPCircleScrollMenu *)adScrollView didEndDisplayView:(UIView *)view forPage:(NSInteger)pageIndex;//某页要消失了

@end
